-- Prefan Access Controller
-- Rocket Man Plugin -- Documentery Plugin

if not SERVER then return end -- If we arn't the server, end.

function PAC.RocketMan( owner, ply, speed ) -- Function, args Caller, Player, and Speed

	local explode = ents.Create( "env_explosion" )
		explode:SetPos( ply:GetPos() )
		explode:SetOwner( ply )
		explode:Spawn()
		explode:Fire( "Explode", 0, 0 )
		
	ply:Kill() -- I want to do a ragdoll version of this too, its funnier.
	ply:SetVelocity( Vector( 0, 0, speed ) ) -- Set the velocity of the player to the up of the speed
	--ply:SetHealth( ply:Health() - speed / 6 ) -- Sets the health to the current, minus the speed / 6
	
	--if ply:Health() <= 0 then ply:Kill() end -- If the player has no health, kill him.
	
	PAC.Print( PAC_CHAT_ALL, Color( 255, 0, 0 ), owner:Nick(), Color( 100, 100, 100 ), " has rocketed ", Color( 255, 0, 0 ), ply:Nick() )
	
end

PAC.AddChatCommand( "rocket", "PLAYER|NUMBER", "moderator", PAC.RocketMan ) -- Add the chat commands
--[[ Arguments for PAC.AddChatCommand ---
	name -- Name of command to be called by, example - rocket is !rocket
	arguments -- String of arguments, separated by a |.  PLAYER gets a player entity, NUMBER and STRING return strings, more can be asked for.
	rank -- Minimal rank that this call can be used
	func -- Function to call, normally what you want.
--]]

PAC.AddPlugin( "Rocket Man", "Shoot people up in the sky!", "Prefanatic" )

-- Name, Discription, Writer
